<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
    
    	Activity ac = (Activity)session.getAttribute("activity");
    	SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
    %>
    	<%
		if(session.getAttribute("isAdminLogined")==null){
			return;
		}else{
			String isAddminLogined = session.getAttribute("isAdminLogined").toString();
			if(!("true".equals(isAddminLogined))){
				response.sendRedirect("login.jsp");
				return;
			}
		}
		
	%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="com.doone.telmarket.domain.Activity"%>
<%@page import="java.text.SimpleDateFormat"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" rev="stylesheet"
	href="${pageContext.request.contextPath}/css/admin/style-admin.css"
	type="text/css" media="all" />
<script type="text/javascript"
	src="${pageContext.request.contextPath}/ckeditor/ckeditor.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/ckeditor/ckeditor.js"></script>

<script src="${pageContext.request.contextPath}/js/jquery.js"
	type="text/javascript"></script>
<script
	src="${pageContext.request.contextPath}/js/jquery.ui.draggable.js"
	type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/jquery.alerts.js"
	type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ajaxfileupload.js"
	type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/serviceOpration.js"
	type="text/javascript"></script>
<link href="${pageContext.request.contextPath}/css/jquery.alerts.css"
	rel="stylesheet" type="text/css" media="screen" />
	<link rel="stylesheet" type="text/css" media="all" href="${pageContext.request.contextPath}/js/calendar-brown.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/calendar.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/calendar-zh.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/calendar-action.js"></script>
<style type="text/css">

.file{border:1px solid #333333;color:#666666;background:#eeeeee;font:normal 12px Tahoma;height:18px}
</style>
<script type="text/javascript">
						/************************************************************/
						var timer;
						function showSmallUpload(){
						    document.getElementById("Layer3").style.display = "";
							var top = (document.body.clientHeight-250)/2+"px";
							var left = (document.body.clientWidth-660)/2+"px";
							var div = document.getElementById("Layer3");
							div.style.top = top;
							div.style.left = left;
							showSmallEdit();
						}
						function showSmallEdit(id){
							 document.getElementById("bgLayer").width = document.body.scrollWidth; 
							 document.all["bgLayer"].style.display="";
							 document.all["bgLayer"].style.height=document.body.scrollHeight;
							// alert(document.getElementById("Layer1"));
							 document.getElementById("Layer3").style.display="";
							 timer=setInterval(moveSmallEdit,"100");
						}
						function hideSmallEdit(){
						clearInterval(timer);
						document.all["bgLayer"].style.display="none";
						document.all["Layer3"].style.display="none";
						}
						function moveSmallEdit(){
						document.all["Layer3"].style.top=document.body.scrollTop+(document.body.clientHeight-250)/2;
						document.all["Layer3"].style.left=document.body.scrollLeft+document.body.clientWidth/2-330;
						}
						function displaySmallDiv(){
						   document.getElementById("Layer3").style.display = "none";
						   hideSmallEdit();
						}	
						/************************************************************/
						function showLogoUpload(){
						    document.getElementById("Layer4").style.display = "";
							var top = (document.body.clientHeight-250)/2+"px";
							var left = (document.body.clientWidth-660)/2+"px";
							var div = document.getElementById("Layer4");
							div.style.top = top;
							div.style.left = left;
							showLogoEdit();
						}
						function showLogoEdit(id){
							 document.getElementById("bgLayer").width = document.body.scrollWidth; 
							 document.all["bgLayer"].style.display="";
							 document.all["bgLayer"].style.height=document.body.scrollHeight;
							// alert(document.getElementById("Layer1"));
							 document.getElementById("Layer4").style.display="";
							 timer=setInterval(moveLogoEdit,"100");
						}
						function hideLogoEdit(){
						clearInterval(timer);
						document.all["bgLayer"].style.display="none";
						document.all["Layer4"].style.display="none";
						}
						function moveLogoEdit(){
						document.all["Layer4"].style.top=document.body.scrollTop+(document.body.clientHeight-250)/2;
						document.all["Layer4"].style.left=document.body.scrollLeft+document.body.clientWidth/2-330;
						}
						function displayLogoDiv(){
						   document.getElementById("Layer4").style.display = "none";
						   hideSmallEdit();
						}	

						window.onload = function(){
							document.getElementById("smallUp").onclick = function(){
								$.ajaxFileUpload   
							    (   
							        {   
							            url:document.getElementById("contextPath").value+'/admin/updateImage?imageName='+document.getElementById("smallName").value,    
							            secureuri:false,   
							            fileElementId:'smallImage',   
							            dataType: '',   
							            success: function(data, status)   
							            {      
							               jAlert(status,'消息');
							               displayLogoDiv();
							            },   
							            error: function (data, status, e)   
							            {   
							            	jAlert("保存文件失败",'消息');
							            	displayLogoDiv();
							            }   
							        }   
							    );
							}

							document.getElementById("bigUp").onclick = function(){
								$.ajaxFileUpload   
							    (   
							        {   
							            url:document.getElementById("contextPath").value+'/admin/updateImage?imageName='+document.getElementById("bigName").value,    
							            secureuri:false,   
							            fileElementId:'bigImage',   
							            dataType: '',   
							            success: function(data, status)   
							            {      
							               jAlert(status,'消息');
							               displayLogoDiv();
							            },   
							            error: function (data, status, e)   
							            {   
							            	jAlert("保存文件失败",'消息');
							            	displayLogoDiv();
							            }   
							        }   
							    );
							}
							  
						}
</script>
</head>
<body>
<div style="z-index: 1;height: 1000">
<input id="contexpath" type="hidden" value="${pageContext.request.contextPath}">
<div class="MainDiv"><input type="hidden" id="contextPath" value="${pageContext.request.contextPath}">
<table width="99%" border="0" cellpadding="0" cellspacing="0"
	class="CContent">
	<tr>
		<th class="tablestyle_title">增值业务管理</th>
	</tr>
	<tr>
		<td class="CPanel">
		<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
			<tr>
				<td align="left">&nbsp;&nbsp;&nbsp;<a href="${pageContext.request.contextPath}/admin/setPromotion.jsp">新增精彩促销</a>
			<a href="${pageContext.request.contextPath}/admin/selectActivity2">编辑精彩促销</a></td>
			</tr>



			<tr align="center">
				<td class="TablePanel"></td>
			</tr>
			<tr>
				<TD width="100%">
				
				<fieldset style="height: 100%;" id="queryResult" ><legend>编辑</legend>
				<form action="${pageContext.request.contextPath}/admin/updateActivity" method="post" id="serviceIdForm">
				<div id="serviceDiv" style="width: 80%">
				
				
				<table>
					<tr>
					    <td nowrap align="right" width="13%">活动名称:</td>
					    <td width="46%"><input name="title" id="title" value="<%=ac.getTitle() %>" class="text" name="title" style="width:300px" type="text" size="40" />
				        <span class="red"> *</span><input type="hidden" value=<%=ac.getId() %> id="activityId" name="id" /></td>
					    <td align="right" width="9%"></td>
					    <td width="32%">&nbsp;</td>
					    </tr>
					    
					    <tr>
					    <td nowrap align="right" width="13%">活动简介:</td>
					    <td width="46%"><input name="content" value="<%=ac.getContent() %>"  id="content" class="text" name="content" style="width:300px" type="text" size="40" />
				        <span class="red"> *</span></td>
					    <td align="right" width="9%"></td>
					    <td width="32%">&nbsp;</td>
					    </tr>
					    
					    <tr>
					    <td nowrap align="right" width="13%">活动链接:</td>
					    <td width="46%"><input name="url" id="url" value="<%=ac.getUrl() %>"   class="text" name="url" style="width:300px" type="text" size="40" />
				        <span class="red"> *</span></td>
					    <td align="right" width="9%"></td>
					    <td width="32%">&nbsp;</td>
					    </tr>
					    
					    <tr>
					    <td nowrap align="right" width="13%">活动对象:</td>
					    <td width="46%"><input name="person" id="person"  value="<%=ac.getPerson() %>"   class="text" name="person" style="width:300px" type="text" size="40" />
				        <span class="red"> *</span></td>
					    <td align="right" width="9%"></td>
					    <td width="32%">&nbsp;</td>
					    </tr>
					    
					    <tr>
					    <td nowrap align="right" width="13%">开始时间:</td>
					    <td width="46%">
					    <input type="text" name="begin" size="12"  value="<%=s.format(ac.getBegin()) %>"   value="" id="begin"  readonly="readonly"  /><span style="cursor:hand" 
					  						   onclick="return showCalendar('begin', '%Y-%m-%d', null, true);">
										<img border="0" src="${pageContext.request.contextPath}/js/date_botton.gif" width="20" height="14"></span>
				        <span class="red"> *</span></td>
					    <td align="right" width="9%"></td>
					    <td width="32%">&nbsp;</td>
					    </tr>
					    
					    <tr>
					    <td nowrap align="right" width="13%">结束时间:</td>
					    <td width="46%">
					    <input type="text" name="end" size="12"  value="<%=s.format(ac.getEnd()) %>"   id="end"  readonly="readonly"  /><span style="cursor:hand" 
					  						   onclick="return showCalendar('end', '%Y-%m-%d', null, true);">
										<img border="0" src="${pageContext.request.contextPath}/js/date_botton.gif" width="20" height="14"></span>
				        <span class="red"> *</span></td>
					    <td align="right" width="9%"></td>
					    <td width="32%">&nbsp;</td>
					    </tr>
					    
					    <tr>
					    <td nowrap align="right" width="13%">小图标:</td>
					    <td width="46%"><input value="点击更改小图标" class="button"  type="button" onclick="showSmallUpload();" />
				        <span class="red"> *</span></td>
					    <td align="right" width="9%"><input type="hidden" id="smallName" value="<%=ac.getImagePath() %>" /></td>
					    <td width="32%">&nbsp;</td>
					    </tr>
					    <tr><td></td><td><img id="img1" width="78" height="69" src="${pageContext.request.contextPath}/<%=ac.getImagePath() %>"/></td></tr>
					    <tr>
					    <td nowrap align="right" width="13%">大图标:</td>
					    <td width="46%"><input value="点击更改大图标" class="button"  type="button" onclick="showLogoUpload();"  />
				        <span class="red"> *</span></td>
					    <td align="right" width="9%"></td>
					    <td width="32%">&nbsp;<input type="hidden" id="bigName" value="<%=ac.getBigImage() %>" /></td>
					    </tr>
					    <tr><td></td><td><img id="img2"  width="354" height="121"  src="${pageContext.request.contextPath}/<%=ac.getBigImage() %>"/></td></tr>
						<tr><td></td><td><input type="submit" value="保存" class="button" /></td></tr>
				</table>
				</div>
				</form>
				</fieldset>
				
				
			
			
				</TD>
			</TR>

		</TABLE>


		</td>
	</tr>
	<TR>
		<TD colspan="2" align="center" height="50px"></TD>
	</TR>
</TABLE>
</div></div>


<div id="Layer3"  style=" display:none; border:0;background-image: url(/images/3Gsjj.jpg);position:absolute;top:1px; left:1px; width:528px; height:70px; z-index:3; text-align:left" >

  <div style="width: 450px;border-color: red;border: 1px solid;background-color: white;height: 130px">
  <fieldset>
  	<legend>上传活动小图片</legend>
  	<table>
  	<tr>
  		<td>
  		　请选择：<input type="file" name="file" id="smallImage"><input type="button"  class="button"  id="smallUp" value="上传">
  		<input type="button" onclick="displaySmallDiv();" class="button" value="取消">
  		</td>
  		<td>
  		</td>
  	</tr>
  	</table>
  </fieldset>
  	
  </div>

</div>
<div id="bgLayer" style="float:left;position:absolute;background:#CCCCCC;left:0px;top:0px;width:100%;height:1000;filter:alpha(style=0,opacity=50);display:none;z-index:2;"></div>
<div id="Layer4"  style=" display:none; border:0;background-image: url(/images/3Gsjj.jpg);position:absolute;top:1px; left:1px; width:528px; height:70px; z-index:3; text-align:left" >

  <div style="width: 450px;border-color: red;border: 1px solid;background-color: white;height: 130px">
  <fieldset>
  	<legend>上传活动大图标</legend>
  	<table>
  	<tr>
  		<td>
  		　请选择：<input type="file" name="file" id="bigImage">
  		<input type="button" id="bigUp"  class="button"  value="上传">
  		<input type="button" onclick="displayLogoDiv();" class="button" value="取消">
  		</td>
  		<td>
  		</td>
  	</tr>
  	</table>
  </fieldset>
  </div>
</div>
</body>
</html>